def maxArea(height):
    ans=0
    i,j=0,len(height)-1
    while(j>i):
        ans=max(ans,(j-i)*min(height[i],height[j]))
        if height[i]<=height[j]:i+=1
        else: j-=1
    return ans

height=[1,8,6,2,5,4,8,3,7]
print(maxArea(height))
    